﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls;
using System.Reflection;

/// <summary>
///BooleanFormField 的摘要说明
/// </summary>
public class BooleanFormField:BaseFormShow
{

    public override IEnumerable<System.Web.UI.Control> GetFieldContrls(PropertyInfo propertyInfo,object value)
    {
        CheckBox field = new CheckBox();
        field.ID = propertyInfo.Name;

        if (value is bool)
        {
            field.Checked = (bool)value;
        }

        yield return field;
    }

    public override object GetValue(PropertyInfo propertyInfo, string value)
    {
        bool r = false;
        bool.TryParse(value, out r);

        return r;
    }
}
